Produced by Araxis Merge on 2020-08-14 00:01:29 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Porto v3.2.3/Magento 2.x/Porto Theme/app/code/Mageplaza/AjaxLayer/Controller/Search/Result | Index.php | 2018-10-10 20:33:22 +0000 |
| 2 | Porto v3.2.4/Magento 2.x/Porto Theme/app/code/Mageplaza/AjaxLayer/Controller/Search/Result | Index.php | 2020-06-26 11:11:14 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 10 | 294 |
| Changed | 5 | 13 |
| Inserted | 3 | 5 |
| Removed | 1 | 1 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | <?php | 1 | <?php | |||
| 2 | /** | 2 | /** | |||
| 3 | * Mageplaza | 3 | * Mageplaza | |||
| 4 | * | 4 | * | |||
| 5 | * NOTICE OF LICENSE | 5 | * NOTICE OF LICENSE | |||
| 6 | * | 6 | * | |||
| 7 | * This source file is subject to the Mageplaza.com license that is | 7 | * This source file is subject to the Mageplaza.com license that is | |||
| 8 | * available through the world-wide-web at this URL: | 8 | * available through the world-wide-web at this URL: | |||
| 9 | * https://www.mageplaza.com/LICENSE.txt | 9 | * https://www.mageplaza.com/LICENSE.txt | |||
| 10 | * | 10 | * | |||
| 11 | * DISCLAIMER | 11 | * DISCLAIMER | |||
| 12 | * | 12 | * | |||
| 13 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 13 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 14 | * version in the future. | 14 | * version in the future. | |||
| 15 | * | 15 | * | |||
| 16 | * @category Mageplaza | 16 | * @category Mageplaza | |||
| 17 | * @package Mageplaza_AjaxLayer | 17 | * @package Mageplaza_AjaxLayer | |||
| 18 | * @copyright Copyright (c) Mageplaza (http://www.mageplaza.com/) | 18 | * @copyright Copyright (c) Mageplaza (http://www.mageplaza.com/) | |||
| 19 | * @license https://www.mageplaza.com/LICENSE.txt | 19 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 20 | */ | 20 | */ | |||
| 21 | 21 | |||||
| 22 | namespace Mageplaza\AjaxLayer\Controller\Search\Result; | 22 | namespace Mageplaza\AjaxLayer\Controller\Search\Result; | |||
| 23 | 23 | |||||
| 24 | use Magento\Catalog\Model\Layer\Resolver; | 24 | use Magento\Catalog\Model\Layer\Resolver; | |||
| 25 | use Magento\Catalog\Model\Session; | 25 | use Magento\Catalog\Model\Session; | |||
| 26 | use Magento\CatalogSearch\Helper\Data; | 26 | use Magento\CatalogSearch\Helper\Data; | |||
| 27 | use Magento\Framework\App\Action\Action; | 27 | use Magento\Framework\App\Action\Action; | |||
| 28 | use Magento\Framework\App\Action\Context; | 28 | use Magento\Framework\App\Action\Context; | |||
| 29 | use Magento\Framework\App\ResponseInterface; | |||||
| 30 | use Magento\Framework\Controller\ResultInterface; | |||||
| 31 | use Magento\Framework\Exception\LocalizedException; | |||||
| 29 | use Magento\Framework\Json\Helper\Data as JsonData; | 32 | use Magento\Framework\Json\Helper\Data as JsonData; | |||
| 33 | use Magento\Search\Model\Query; | |||||
| 30 | use Magento\Search\Model\QueryFactory; | 34 | use Magento\Search\Model\QueryFactory; | |||
| 31 | use Magento\Store\Model\StoreManagerInterface; | 35 | use Magento\Store\Model\StoreManagerInterface; | |||
| 32 | use Mageplaza\AjaxLayer\Helper\Data as HelperData; | 36 | use Mageplaza\AjaxLayer\Helper\Data as HelperData; | |||
| 33 | 37 | |||||
| 34 | /** | 38 | /** | |||
| 35 | * Class Index | 39 | * Class Index | |||
| 36 | * @package Mageplaza\LayeredNavigation\Controller\Search\Result | 40 | * @package Mageplaza\LayeredNavigation\Controller\Search\Result | |||
| 37 | */ | 41 | */ | |||
| 38 | class Index extends Action | 42 | class Index extends Action | |||
| 39 | { | 43 | { | |||
| 40 | /** | 44 | /** | |||
| 41 | * Catalog session | 45 | * Catalog session | |||
| 42 | * | 46 | * | |||
| 43 | * @var Session | 47 | * @var Session | |||
| 44 | */ | 48 | */ | |||
| 45 | protected $_catalogSession; | 49 | protected $_catalogSession; | |||
| 46 | 50 | |||||
| 47 | /** | 51 | /** | |||
| 48 | * @var StoreManagerInterface | 52 | * @var StoreManagerInterface | |||
| 49 | */ | 53 | */ | |||
| 50 | protected $_storeManager; | 54 | protected $_storeManager; | |||
| 51 | 55 | |||||
| 52 | /** | 56 | /** | |||
| 53 | * @type JsonData | 57 | * @type JsonData | |||
| 54 | */ | 58 | */ | |||
| 55 | protected $_jsonHelper; | 59 | protected $_jsonHelper; | |||
| 56 | 60 | |||||
| 57 | /** | 61 | /** | |||
| 58 | * @type \Mageplaza\LayeredNavigation\Helper\Data | 62 | * @var HelperData | |||
| 59 | */ | 63 | */ | |||
| 60 | protected $_moduleHelper; | 64 | protected $_moduleHelper; | |||
| 61 | 65 | |||||
| 62 | /** | 66 | /** | |||
| 63 | * @type Data | 67 | * @type Data | |||
| 64 | */ | 68 | */ | |||
| 65 | protected $_helper; | 69 | protected $_helper; | |||
| 66 | 70 | |||||
| 67 | /** | 71 | /** | |||
| 68 | * @var QueryFactory | 72 | * @var QueryFactory | |||
| 69 | */ | 73 | */ | |||
| 70 | private $_queryFactory; | 74 | private $_queryFactory; | |||
| 71 | 75 | |||||
| 72 | /** | 76 | /** | |||
| 73 | * Catalog Layer Resolver | 77 | * Catalog Layer Resolver | |||
| 74 | * | 78 | * | |||
| 75 | * @var Resolver | 79 | * @var Resolver | |||
| 76 | */ | 80 | */ | |||
| 77 | private $layerResolver; | 81 | private $layerResolver; | |||
| 78 | 82 | |||||
| 79 | /** | 83 | /** | |||
| 80 | * Index constructor. | 84 | * Index constructor. | |||
| 85 | * | |||||
| 81 | * @param Context $context | 86 | * @param Context $context | |||
| 82 | * @param Session $catalogSession | 87 | * @param Session $catalogSession | |||
| 83 | * @param StoreManagerInterface $storeManager | 88 | * @param StoreManagerInterface $storeManager | |||
| 84 | * @param QueryFactory $queryFactory | 89 | * @param QueryFactory $queryFactory | |||
| 85 | * @param Resolver $layerResolver | 90 | * @param Resolver $layerResolver | |||
| 86 | * @param Data $helper | 91 | * @param Data $helper | |||
| 87 | * @param JsonData $jsonHelper | 92 | * @param JsonData $jsonHelper | |||
| 88 | * @param HelperData $moduleHelper | 93 | * @param HelperData $moduleHelper | |||
| 89 | */ | 94 | */ | |||
| 90 | public function __construct( | 95 | public function __construct( | |||
| 91 | Context $context, | 96 | Context $context, | |||
| 92 | Session $catalogSession, | 97 | Session $catalogSession, | |||
| 93 | StoreManagerInterface $storeManager, | 98 | StoreManagerInterface $storeManager, | |||
| 94 | QueryFactory $queryFactory, | 99 | QueryFactory $queryFactory, | |||
| 95 | Resolver $layerResolver, | 100 | Resolver $layerResolver, | |||
| 96 | Data $helper, | 101 | Data $helper, | |||
| 97 | JsonData $jsonHelper, | 102 | JsonData $jsonHelper, | |||
| 98 | HelperData $moduleHelper | 103 | HelperData $moduleHelper | |||
| 99 | ) | 104 | ) { | |||
| 100 | { | |||||
| 101 | $this->_storeManager = $storeManager; | 105 | $this->_storeManager = $storeManager; | |||
| 102 | $this->_catalogSession = $catalogSession; | 106 | $this->_catalogSession = $catalogSession; | |||
| 103 | $this->_queryFactory = $queryFactory; | 107 | $this->_queryFactory = $queryFactory; | |||
| 104 | $this->layerResolver = $layerResolver; | 108 | $this->layerResolver = $layerResolver; | |||
| 105 | $this->_jsonHelper = $jsonHelper; | 109 | $this->_jsonHelper = $jsonHelper; | |||
| 106 | $this->_moduleHelper = $moduleHelper; | 110 | $this->_moduleHelper = $moduleHelper; | |||
| 107 | $this->_helper = $helper; | 111 | $this->_helper = $helper; | |||
| 108 | 112 | |||||
| 109 | parent::__construct($context); | 113 | parent::__construct($context); | |||
| 110 | } | 114 | } | |||
| 111 | 115 | |||||
| 112 | /** | 116 | /** | |||
| 113 | * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|void | 117 | * @return | |||
| 114 | * @throws \Magento\Framework\Exception\LocalizedException | 118 | * @throws | |||
| 115 | */ | 119 | */ | |||
| 116 | public function execute() | 120 | public function execute() | |||
| 117 | { | 121 | { | |||
| 118 | $this->layerResolver->create(Resolver::CATALOG_LAYER_SEARCH); | 122 | $this->layerResolver->create(Resolver::CATALOG_LAYER_SEARCH); | |||
| 119 | /* @var $query \Magento\Search\Model\Query */ | 123 | /* @var $query | |||
| 120 | $query = $this->_queryFactory->get(); | 124 | $query = $this->_queryFactory->get(); | |||
| 121 | 125 | |||||
| 122 | $query->setStoreId($this->_storeManager->getStore()->getId()); | 126 | $query->setStoreId($this->_storeManager->getStore()->getId()); | |||
| 123 | 127 | |||||
| 124 | if ($query->getQueryText() != | 128 | if ($query->getQueryText() !== '') { | |||
| 125 | if ($this->_helper->isMinQueryLength()) { | 129 | if ($this->_helper->isMinQueryLength()) { | |||
| 126 | $query->setId(0)->setIsActive(1)->setIsProcessed(1); | 130 | $query->setId(0)->setIsActive(1)->setIsProcessed(1); | |||
| 127 | } else { | 131 | } else { | |||
| 128 | $query->saveIncrementalPopularity(); | 132 | $query->saveIncrementalPopularity(); | |||
| 129 | ||||||
| 130 | if ($query->getRedirect()) { | 133 | if ($query->getRedirect()) { | |||
| 131 | $this->getResponse()->setRedirect($query->getRedirect()); | 134 | $this->getResponse()->setRedirect($query->getRedirect()); | |||
| 132 | 135 | |||||
| 133 | return; | 136 | return; | |||
| 134 | } | 137 | } | |||
| 135 | } | 138 | } | |||
| 136 | 139 | |||||
| 137 | $this->_helper->checkNotes(); | 140 | $this->_helper->checkNotes(); | |||
| 138 | $this->_view->loadLayout(); | 141 | $this->_view->loadLayout(); | |||
| 139 | 142 | |||||
| 140 | if ($this->_moduleHelper->ajaxEnabled() && $this->getRequest()->isAjax()) { | 143 | if ($this->_moduleHelper->ajaxEnabled() && $this->getRequest()->isAjax()) { | |||
| 141 | $navigation = $this->_view->getLayout()->getBlock('catalogsearch.leftnav'); | 144 | $navigation = $this->_view->getLayout()->getBlock('catalogsearch.leftnav'); | |||
| 142 | $products = $this->_view->getLayout()->getBlock('search.result'); | 145 | $products = $this->_view->getLayout()->getBlock('search.result'); | |||
| 143 | $result = [ | 146 | $result = [ | |||
| 144 | 'products' => $products->toHtml(), | 147 | 'products' => $products->toHtml(), | |||
| 145 | 'navigation' => $navigation->toHtml() | 148 | 'navigation' => $navigation->toHtml() | |||
| 146 | ]; | 149 | ]; | |||
| 147 | $this->getResponse()->representJson($this->_jsonHelper->jsonEncode($result)); | 150 | $this->getResponse()->representJson($this->_jsonHelper->jsonEncode($result)); | |||
| 148 | } else { | 151 | } else { | |||
| 149 | $this->_view->renderLayout(); | 152 | $this->_view->renderLayout(); | |||
| 150 | } | 153 | } | |||
| 151 | } else { | 154 | } else { | |||
| 152 | $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); | 155 | $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl()); | |||
| 153 | } | 156 | } | |||
| 154 | } | 157 | } | |||
| 155 | } | 158 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.